
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Add</title>
    <script type="text/javascript" src="js/jquery-1.8.3.min.js"></script>
    <script type="text/javascript">
        $(function (){
            $("#username").blur(function (){
                //1、获取当前用户名
                var sname = $(this).val();
                //2、将value值发送给服务器
                $.ajax({
                    url:"/checkuname",
                    type:"post",
                    data:"uname="+sname,
                    dataType:"text",
                    success:function (returndata){
                        $("#rs").html(returndata);
                    }
                });
            });

        })

    </script>
    <style type="text/css">
        span{color:red}
    </style>
</head>
<body>
   <h1>add.jsp,欢迎您:${sessionScope.u1.userName}
       <a href="/usersServlet?key=loginout">退出</a>
   </h1>
   <form action="/usersServlet?key=adduser" method="post">
       username:<input type="text" id="username" name="uname"  ><span id="rs"></span><br>
       sex:<input type="radio" name="usex" value="男" >男
       <input type="radio" name="usex" value="女" >女 <br>
       age:<input type="text" name="uage" ><br>
       password:<input type="text" name="upass" ><br>
       <input type="submit" value="保存">
   </form>

</body>
</html>
